package service

import (
	"go-frame/src/server-main/dao"
	"go-frame/src/server-main/models"
)

type ProductService struct {
	ProductDAO *dao.ProductDAO
}

func NewProductService(productDAO *dao.ProductDAO) *ProductService {
	return &ProductService{ProductDAO: productDAO}
}

func (s *ProductService) GetAllProducts() ([]models.Product, error) {
	return s.ProductDAO.GetAllProducts()
}

func (s *ProductService) CreateProduct(product *models.Product) error {
	return s.ProductDAO.CreateProduct(product)
}

func (s *ProductService) GetProductByID(id uint) (models.Product, error) {
	return s.ProductDAO.GetProductByID(id)
}

func (s *ProductService) UpdateProduct(product *models.Product) error {
	return s.ProductDAO.UpdateProduct(product)
}

func (s *ProductService) DeleteProduct(id uint) error {
	return s.ProductDAO.DeleteProduct(id)
}
